package com.example.design.函数式编程.h去重与排序;

import com.example.design.函数式编程.a函数对象化.Sample01;

import java.util.Comparator;
import java.util.stream.IntStream;
import java.util.stream.Stream;

public class SortTest {

    public static void main(String[] args) {
        // 去重
        IntStream.of(1,1,2,3).distinct().forEach(System.out::println);

        // 排序
        Stream.of(
                new Sample01.Student("a", "man", 1112),
                new Sample01.Student("b", "man", 112312),
                new Sample01.Student("c", "man", 122),
                new Sample01.Student("d", "man", 132)

        ).sorted(Comparator.comparingInt(item -> item.getAge())).forEach(System.out::println);

    }
}
